<template><!--利益分配-->
  <div>
    <div v-show='show' class="wrap" v-for='(item,index) in list'>
      
      <div class="details">
        <div class="user">
          <span>{{item.name}}</span>
          <br>
          <span class="tips">{{item.publishTime | toTime}}</span>
        </div>
        <div class="products">
          <span>{{item.stockName}}</span>
          <br>
          <span class="tips">{{item.stockNum}}股</span>
        </div>
        <div class="profit" >
        	<p>盈利分配</p>
        	<p style="color: #fffc24;">{{item.profit | toDot }}</p>
        </div>
      </div>
     
    </div>
  	 <p style="color: white; text-align: center; height: 4.72rem; line-height: 4.72rem;" v-show="list.length==0&&show">暂无数据</p>
  </div>
</template>
<script>
	import home from '@/api/home/index'
	import { toast,isRealName,isBankNumber } from '@/util/index'
export default {
  data(){
    return {
      list:""
    }
  },
  mounted(){
  		let senddata = {
					plat:"mlj"
			}
			home.expert(senddata).then((data) => {
				if (data.data.code == 200) {
				//	console.log(data.data.data)
					this.list=data.data.data
				} else {
					toast(data.data.message)
				}
			})
				
  },
  filters:{
  	toTime(time){
  		//console.log(time);
  		var oldTime = (new Date(time)).getTime(); 
  		var d = new Date();
  		var newTime = Date.parse(new Date());
  		var value =newTime-oldTime;
  		if((value / 1000 / 60 / 60)<24){
  			return  Math.floor(value / 1000 / 60 / 60)+"小时前";
  		}else if((value / 1000 / 60 / 60)>24){
  			return  Math.floor(value / 1000 / 60 / 60/24)+"天前";
  		}
  		
  		
  		
  		
  	},
  	toDot(val){
  		return parseInt(val);
  		
  	}
  },
  props: {
    show: {
      type: Boolean,
      default: true
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../less/config.less';
.wrap {
  height: 1.6rem;
  color: @fcolor;
  font-size: 0.37333rem;
  padding: 0 @p30;
  border-bottom: 1px solid #1f232e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .icon{
    width: 0.64rem;
    height: 0.73333rem;
    text-align: center;
  }
  img {
    width: 0.64rem;
    height: 0.73333rem;
  }
  .details {
    position: relative;
    height: 1.6rem;
    width: 7.81333rem;
    margin-left: 0.74667rem;
    div {
      position: absolute;
      line-height: 1.5;
    }
    .user {
      top: 0.3rem;
      left: 0;
    }
    .products {
      top: 0.3rem;
      left: 3rem;
      text-align: center;
    }
    .profit {
    	width: 1.6rem;
    	height: 0.506rem;
      top: 0.3rem;
      right: 0;
      text-align: center;
     
    }
    .tips {
      color: @Color;
      font-size: 0.32rem;
    }
    .Price {
      color: @actColor;
      font-size: 0.32rem;
    }
  }
}
</style>
